#include "LeiJiaKeyBoard.h"

LeiJiaKeyBoard::LeiJiaKeyBoard(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);

	connect(ui.btl_0, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_1, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_2, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_3, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_4, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_5, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_6, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_7, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_8, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_9, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_a, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_b, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_c, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_d, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_e, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_f, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_g, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_h, SIGNAL(clicked()), this, SLOT(btl_clicked()));
	connect(ui.btl_delete, SIGNAL(clicked()), this, SLOT(btl_clicked()));


	QString  style = QString::fromLocal8Bit("QPushButton{border - radius: 8px;\
													bo rder: 2px solid;\
													border - color:#666666;\
												    color:#666666;\
													background - color:transparent;}\
													QPushButton:pressed	{background - color:#666666;\
													border - style: inset;\
													border - radius: 8px;\
												    border: 2px solid;\
													border - color:#666666;\
													color:#999999;}");
}

LeiJiaKeyBoard::~LeiJiaKeyBoard()
{

}


void LeiJiaKeyBoard::btl_clicked()
{
	QPushButton * btl = qobject_cast<QPushButton*>(sender());
	QString btlName = btl->objectName();
	if (btlName != "btl_delete")
		emit key(btl->text());
	else
	{
		emit sig_delete();
	}

}